#ifndef SIXTEENJT_PROTOCOL_H
#define SIXTEENJT_PROTOCOL_H

/**
 * @brief 帧头1
 */
#define STX1		        0x43

/**
 * @brief 帧头2
 */
#define STX2        		0x4D

/**
 * @brief 帧头长度
 */
#define HEADER_LEN		0x08

/**
 * @brief 获取版本号
 */
#define CMD_GET_VER         0x01

/**
 * @brief 心跳
 */
#define CMD_ALIVE           0x06

/**
 * @brief 选定读标签
 */
#define CMD_SEL_READ        0x83

/**
 * @brief 设置天线
 */
#define CMD_SET_ANT         0x86

/**
 * @brief 获取天线
 */
#define CMD_GET_ANT         0x87

/**
 * @brief 单次盘点
 */
#define CMD_INV_ONCE        0x8E

/**
 * PC到读写器
 */
#define STX_HOST_2_SLAVE    0x02

/**
 * 读写器到PC
 */
#define STX_SLAVE_2_HOST    0x03

#pragma pack(1)
struct JT_HEADER {
    unsigned char header1;
    unsigned char header2;
    unsigned char cmd;
    unsigned char dir;
    unsigned short len;
    unsigned short machine;
};

struct JT_ANT {
    unsigned char idx;
    unsigned char power;
    unsigned short work_ms;
    unsigned short sleep_ms;
};

struct JT_ANT_16 {
    unsigned char store;
    unsigned char count;
    unsigned short enable;
    JT_ANT ants[16];
};

/**
 * 选中标签参数
 */
typedef struct SEL_MASK {
    unsigned char ant;
    unsigned short channels;
    unsigned char mask[12];
    int len;
};
#pragma pack()

/**
 * @brief RFID 返回值
 */
enum RFID_STATUS {
    RFID_SUCCESS = 0,
    RFID_FAIL = 0x80
};

#endif //SIXTEENJT_PROTOCOL_H
